package com.winenine999.generator.dao;

import com.winenine999.model.Wineproduct;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface WineproductMapper {
    @Delete({
        "delete from wineproduct",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into wineproduct (id, proname, ",
        "brandid, typeid, ",
        "proaddress, alcohol, ",
        "winefactoryid, promaterial, ",
        "procapacity, protrait, ",
        "prostandard, prodetail, ",
        "price, imageurl, ",
        "imagename)",
        "values (#{id,jdbcType=INTEGER}, #{proname,jdbcType=VARCHAR}, ",
        "#{brandid,jdbcType=INTEGER}, #{typeid,jdbcType=INTEGER}, ",
        "#{proaddress,jdbcType=VARCHAR}, #{alcohol,jdbcType=VARCHAR}, ",
        "#{winefactoryid,jdbcType=INTEGER}, #{promaterial,jdbcType=VARCHAR}, ",
        "#{procapacity,jdbcType=DOUBLE}, #{protrait,jdbcType=VARCHAR}, ",
        "#{prostandard,jdbcType=VARCHAR}, #{prodetail,jdbcType=VARCHAR}, ",
        "#{price,jdbcType=DOUBLE}, #{imageurl,jdbcType=VARCHAR}, ",
        "#{imagename,jdbcType=VARCHAR})"
    })
    int insert(Wineproduct record);

    int insertSelective(Wineproduct record);

    @Select({
        "select",
        "id, proname, brandid, typeid, proaddress, alcohol, winefactoryid, promaterial, ",
        "procapacity, protrait, prostandard, prodetail, price, imageurl, imagename",
        "from wineproduct",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("com.winenine999.generator.dao.WineproductMapper.BaseResultMap")
    Wineproduct selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Wineproduct record);

    @Update({
        "update wineproduct",
        "set proname = #{proname,jdbcType=VARCHAR},",
          "brandid = #{brandid,jdbcType=INTEGER},",
          "typeid = #{typeid,jdbcType=INTEGER},",
          "proaddress = #{proaddress,jdbcType=VARCHAR},",
          "alcohol = #{alcohol,jdbcType=VARCHAR},",
          "winefactoryid = #{winefactoryid,jdbcType=INTEGER},",
          "promaterial = #{promaterial,jdbcType=VARCHAR},",
          "procapacity = #{procapacity,jdbcType=DOUBLE},",
          "protrait = #{protrait,jdbcType=VARCHAR},",
          "prostandard = #{prostandard,jdbcType=VARCHAR},",
          "prodetail = #{prodetail,jdbcType=VARCHAR},",
          "price = #{price,jdbcType=DOUBLE},",
          "imageurl = #{imageurl,jdbcType=VARCHAR},",
          "imagename = #{imagename,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Wineproduct record);
}